<?
if($id<>" "){
$db->connectdb(DB_NAME,DB_USERNAME,DB_PASSWORD);
	$q[Pageview] = "UPDATE ".TB_DOWNLOAD." SET pageview = pageview+1 WHERE id = '".$_GET[id2]."' ";
	$sql[Pageview] = mysql_query ( $q[Pageview] ) or sql_error ( "db-query",mysql_error() );
		$db->closedb ();
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style3 {color: #000066; font-weight: bold; }
-->
</style>
</head>
<body>
<table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><table bordercolor="#d9d9d9" cellspacing="0" 
                  bordercolordark="#ffffff" cellpadding="2" width="87%" align="center" 
                  bordercolorlight="#d9d9d9" border="1">
      <tbody>
        <tr>
          <td height="90" valign="top"><table width="200"   bordercolorlight="#d9d9d9" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td><table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><img src="modules/soundbox/redio.png" width="288" height="111" /></td>
                  </tr>
                  <tr>
                    <td><object id="mediaPlayer" height="23" width="288" 
                              classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95">
                      <param name="fileName" value='<? echo "download/".$id;  ?>' valuetype='ref' />
                      <param name="AutoStart" value="no" />
                      <param name="TransparentAtStart" value="true" />
                      <param name="SendPlayStateChangeEvents" value="true" />
                      <param name="ShowControls" value="0" />
                      <param name="ShowDisplay" value="0" />
                      <param name="ShowStatusBar" value="1" />
                      <param name="ShowGotoBar" value="0" />
                      <param name="ShowPositionControls" value="0" />
                      <param name="AutoSize" value="0" />
                      <param name="volume" value="0" />
                      <param name="loop" value="0" />
                    </object></td>
                  </tr>
                  <tr>
                    <td><img style="CURSOR: pointer" 
                              onclick="mediaPlayer.play()" height="30" 
                              src="modules/soundbox/play-48x48.png" 
                              width="30" /><img style="CURSOR: pointer" 
                              onclick="mediaPlayer.pause()" height="30" 
                              src="modules/soundbox/puse-48x48.png" 
                              width="30" /><img 
                              src="modules/soundbox/stop-48x48.png" 
                              width="30" height="30" style="CURSOR: pointer" 
                              onclick="mediaPlayer.stop()" /></td>
                  </tr>
                </table></td>
            </tr>
            
            <tr>
              <td><TABLE cellSpacing=0 cellPadding=0 width=670 border=0>
      <TBODY>
        <TR>
          <TD width="10" vAlign=top></TD>
          <TD width="650" vAlign=top>
				<TABLE width="650" align=center cellSpacing=0 cellPadding=0 border=0>
				<TR>
					<TD></TD>
				</TR>
				<TR>
					<TD>
					  <div align="left">
					    <?
//////////////////////////////////////////// แสดงรายการ download  
if($_GET[op] == ""){
	$db->connectdb(DB_NAME,DB_USERNAME,DB_PASSWORD);
	$limit = 20 ;
	$SUMPAGE = $db->num_rows(TB_DOWNLOAD,"id","");
	$page=$_GET[page];
	if (empty($page)){
		$page=1;
	}
	$rt = $SUMPAGE%$limit ;
	$totalpage = ($rt!=0) ? floor($SUMPAGE/$limit)+1 : floor($SUMPAGE/$limit); 
	$goto = ($page-1)*$limit ;
?>
					    </div>
					  <div align="left"></div><form action="?name=admin&file=download&op=download_del&action=multidel" name="myform" method="post">
 <table width="100%" cellspacing="2" cellpadding="1" >
  <tr bgcolor="#990000" height=25>
   <td align=center bgcolor="#FFCC99"><span class="style3">รายการย้อยหลัง </span></td>
   <td width="50" bgcolor="#FFCC99"><CENTER class="style3">
     size
   </CENTER></td>
      <td width="60" bgcolor="#FFCC99"><CENTER class="style3">
        ดาวน์โหลด
      </CENTER></td>
      <td width="50" bgcolor="#FFCC99"><CENTER class="style3">
        เปิดฟัง
      </CENTER></td>
      <td width="50" bgcolor="#FFCC99"><CENTER class="style3">
        ไฟล์
      </CENTER></td>
  </tr>  
<?
$res[download] = $db->select_query("SELECT * FROM ".TB_DOWNLOAD." where status='1' ORDER BY id DESC LIMIT $goto, $limit ");
$rank=1;
$count=0;
while($arr[download] = $db->fetch($res[download])){
	if ($page>1){
	$p=$page*10;
	$ranks=$rank+$p;
	} else {
		$ranks=$rank;
	}
			if($Color == 0){
		$Color = 1 ;
		$ColorFill = "#F0F0F0";
	}else{
		$Color = 0 ;
		$ColorFill = "#FDEAFB";
	}
	$res[category] = $db->select_query("SELECT * FROM ".TB_DOWNLOAD_CAT." WHERE id='".$arr[download][category]."' ");
	$arr[category] = $db->fetch($res[category]);
	$newsid=$arr[download][id];
	$ress[com] = $db->select_query("SELECT *,count(id) as com FROM ".TB_DOWNLOAD_COMMENT." WHERE id ='".$newsid."' group by id"); 
	$arrs[com] = $db->fetch($ress[com]);

	//Comment Icon
	if($arr[download][enable_comment]){
		$CommentIcon = " <IMG SRC=\"images/icon/suggest.gif\" WIDTH=\"13\" HEIGHT=\"9\" BORDER=\"0\" ALIGN=\"absmiddle\">";
	}else{
		$CommentIcon = "";
	}
?>
    <tr>
     <td bgcolor="<?=$ColorFill; ?>" valign="top"><?echo $arr[download][topic];?><?=$CommentIcon;?><?=NewsIcon(TIMESTAMP, $arr[download][post_date], "images/icon_new.gif");?><font color="#CC3300">( ลงวันที่ : <?echo ThaiTimeConvert($arr[download][post_date],'','');?> || ฟัง : 
       <?=$arr[download][pageview];?>
         )</font></td>
	      <td align="center" bgcolor="<?=$ColorFill; ?>" valign="top">
<?	
	$bytes=$arr[download][size];
	echo getfilesize($bytes) ;?>		  </td>
		  	      <td align="center" bgcolor="<?=$ColorFill; ?>" valign="top">
				  <?=$arr[download][rate];?>				  </td>
                  <td align="center" bgcolor="<?=$ColorFill; ?>" valign="top"><a href="?name=soundbox&file=index&id=<? echo $arr[download][full_text];?>"> <? 
	 if ($arr[download][type]=="audio/mpeg") {
		 ?>
		  <img src="images/pray-sound_clip.gif" border="0" >
		  <?
		  	 }?></a></td>
                  <td align="center" bgcolor="<?=$ColorFill; ?>" valign="top">
		  <A HREF="?name=download&file=rate&id=<?=$arr[download][id]; ?>" ><img src="images/download.JPG"  border="0" align="absmiddle" /></td>
    </tr>
	<TR>
		<TD colspan="5" height="1" class="dotline"></TD>
	</TR>
<?
		  $rank++;
	 $count++;

//echo "</Tr><TR><TD colspan=2 height=\"1\" class=\"dotline\"></TD></TR>";
if (($count%_NEWS_COL) == 0) { //echo "</TR><TR><TD colspan=6 height=\"1\" class=\"dotline\"></TD></TR>"; $count=0; 
} else{	echo "</Td>";} 
 } 
?>
 </table>
 </form><BR><BR>
<?
	SplitPage($page,$totalpage,"?name=admin&file=download");
	echo $ShowSumPages ;
	echo "<BR>";
	echo $ShowPages ;
}

?>
						<BR><BR>					</TD>
				</TR>
			</TABLE>
			<BR><BR>
			<!-- Admin -->		  </TD>
        </TR>
      </TBODY>
    </TABLE></td>
            </tr>
          </table>          
          <p><br />
          </p></td>
        </tr>
      </tbody>
    </table></td>
  </tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>
